package util

import (
	"context"
	"fmt"
	"go.uber.org/zap"
)

// Catch go func 执行 recover
func Catch(ctx context.Context, slog *zap.SugaredLogger) {
	var errMsg string
	if r := recover(); r != nil {
		errMsg = fmt.Sprintf("nsq recover panic:%s", r)
	}
	if errMsg != "" {
		slog.Errorf("go routine err catch:%s", errMsg)
	}
}
